//
//  ACEStudentDetailListFooterView.m
//  ACE
//
//  Created by zhangtao on 2018/8/10.
//  Copyright © 2018年 zt.td. All rights reserved.
//

#import "ACEStudentDetailListFooterView.h"

@implementation ACEStudentDetailListFooterView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(2, 2, frame.size.width-4, frame.size.height-4)];
        view.layer.cornerRadius = 5;
        view.backgroundColor = [UIColor whiteColor];
        view.layer.shadowColor = lightGreen.CGColor;//shadowColor阴影颜色
        view.layer.shadowOffset = CGSizeMake(0,0);//shadowOffset阴影偏移,x向右偏移4，y向下偏移4，默认(0, -3)
        view.layer.shadowOpacity = 0.8;//阴影透明度，默认0
        view.layer.shadowRadius = 2;//阴影半径，默认3
        [self addSubview:view];

        UIButton *commentBtn = [[UIButton alloc]initWithFrame:CGRectMake(frame.size.width/4-50, frame.size.height/2-20, 100, 40)];
        [commentBtn setImage:[UIImage imageNamed:@"待评价"] forState:UIControlStateNormal];
        [self addSubview:commentBtn];
        [commentBtn setTitle:@"评价" forState:UIControlStateNormal];
        [commentBtn setImageEdgeInsets:UIEdgeInsetsMake(0, -5, 0, 5)];
        [commentBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 5, 0, -5)];
        [commentBtn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        commentBtn.titleLabel.font = [UIFont systemFontOfSize:17];
        [commentBtn setTag:student_detail_list_comment];
        [commentBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        
        UILabel *line = [[UILabel alloc]initWithFrame:CGRectMake(self.center.x-1, 15, 2, frame.size.height-30)];
        line.backgroundColor = deepGreen;
        [self addSubview:line];
        
      
        UIButton *dateBtn = [[UIButton alloc]initWithFrame:CGRectMake(frame.size.width/4*3-50, frame.size.height/2-20, 100, 40)];
        [self addSubview:dateBtn];
        [dateBtn setImage:[UIImage imageNamed:@"日期"] forState:UIControlStateNormal];
        [dateBtn setTitle:@"日期" forState:UIControlStateNormal];
        [dateBtn setImageEdgeInsets:UIEdgeInsetsMake(0, -5, 0, 5)];
        [dateBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 5, 0, -5)];
        
        [dateBtn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        dateBtn.titleLabel.font = [UIFont systemFontOfSize:17];
        [dateBtn setTag:studen_deatail_list_date];
        [dateBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

-(void)click:(UIButton *)btn{
    if (!self.studentDetailListFooterClickCallBack) {
        return;
    }
    
    if (btn.tag == student_detail_list_comment) {
        self.studentDetailListFooterClickCallBack(student_detail_list_comment);
    }else{
        self.studentDetailListFooterClickCallBack(studen_deatail_list_date);
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
